package com.bh.web.controller.extend;

import com.bh.common.core.controller.BaseController;
import com.bh.common.core.domain.AjaxResult;
import com.bh.common.core.page.TableDataInfo;
import com.bh.extend.domain.JcAbnormal;
import com.bh.extend.service.IJcAbnormalService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 异常Controller
 * 
 * @author slx
 * @date 2023-12-15
 */
@RestController
@RequestMapping("/extend/abnormal")
public class JcAbnormalController extends BaseController
{
    @Autowired
    private IJcAbnormalService jcAbnormalService;

    /**
     * 查询异常列表,可以查询运单、订单、运输单
     */
    @ApiOperation("查询异常列表")
    @PreAuthorize("@ss.hasPermi('extend:abnormal:list')")
    @GetMapping("/orderList")
    public TableDataInfo orderList(JcAbnormal jcAbnormal)
    {
        startPage();
        jcAbnormal.setType(0);
        List<JcAbnormal> list = jcAbnormalService.selectJcAbnormalList(jcAbnormal);
        return getDataTable(list);
    }


    /**
     * 查询异常列表,可以查询运单、订单、运输单
     */
    @ApiOperation("查询异常列表")
    @PreAuthorize("@ss.hasPermi('extend:abnormal:list')")
    @GetMapping("/shipmentList")
    public TableDataInfo shipmentList(JcAbnormal jcAbnormal)
    {
        startPage();
        jcAbnormal.setType(1);
        List<JcAbnormal> list = jcAbnormalService.selectJcAbnormalList(jcAbnormal);
        return getDataTable(list);
    }

    /**
     * 获取异常详细信息
     */
    @ApiOperation("获取异常详细信息")
    @PreAuthorize("@ss.hasPermi('extend:abnormal:query')")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(jcAbnormalService.selectJcAbnormalById(id));
    }
}
